<?php
/*首页数据接口*/
namespace Admin\Controller;
use Think\Controller;
use Org\Util\Bodyguard;
use Org\Util\HundredCredit;
class CreditController extends Controller {
    /**
     * 信贷保镖检测
     */
    public function bodyGuard() {
        $api_type  = I('post.apt_type');
        $userid    = I('post.userid');
        $wayid     = I('post.wayid');
        $user_mdb  = M('user');
        $wayuser   = M('wayuser');
        $guard     = new Bodyguard;
        if($wayid){
            $userData  = $wayuser->where(array('id'=>$userid))->field('identify,name,banknum,tel')->find();
            $userData['fullanme'] = $userData['name'];
        }else{
            $userData  = $user_mdb->where(array('id'=>$userid))->field('identify,fullanme,liveaddress,companyaddress,tel,credittype')->find();
        }
        switch(strtolower($api_type)){
            case 'antifraud':
                $antidata = $guard->antiFraudFilter(
                    $userData['fullanme'],
                    $userData['identify'],
                    $userData['tel']
                );
                if($antidata['success']===true){
                    $response = ['success'=>'OK','message'=>$antidata['message']];
                }else if($antidata['success']=='1'&&$antidata['data']){
                    $response = ['success'=>'OK','message'=>'身份信息监测到异常','data'=>$antidata['data']];
                }else if(!$antidata['success']){
                    $response = ['success'=>'ERROR','error'=>$antidata['error'],'message'=>$antidata['message']];
                }else{
                    $response = ['success'=>'ERROR','error'=>'10001','message'=>'数据调取异常！','data'=>$antidata];
                }
                break;
            case 'phonewhenlong':
                $phonewhendata = $guard->phoneWhenlongFilter(
                    $userData['tel']
                );
                if($phonewhendata['success']===true){
                    $str = $phonewhendata['data'];
                    $str=trim($str, "(");
                    $str=trim($str, "[");
                    $str=trim($str, "]");
                    $str=trim($str, ")");
                    $rest=explode(',', $str);
                    if($rest[1] == "+"){
                       $datares_m = "24个月以上";
                    }else{
                       $datares_m = "0~6个月";
                    }
                    $response = [
                        'success'=>'OK',
                        'data'=>$datares_m.'/'.$phonewhendata['data'],
                        'message'=>'数据调取成功'
                    ];
                }else if(!empty($phonewhendata['error'])){
                    $response = ['success'=>'ERROR','error'=>$phonewhendata['erro'],'message'=>$phonewhendata['message']."\nERROR:".$phonewhendata['erro']];
                }else{
                    $response = ['success'=>'ERROR','error'=>'10002','data'=>$phonewhendata,'message'=>'数据调取异常！'];
                }
                break;
            case 'homeaddressverification':
                $homeaddress = $guard->homeAddressVerificationFilter(
                    $userData['liveaddress'],
                    $userData['tel']
                );
                
                if($homeaddress['success']===true){
                    if($homeaddress['data']=='1'){
                        $message = '家庭地址经检测正确！';
                    }else if($homeaddress['data']=='2'){
                        $message = '无记录';
                    }else if($homeaddress['data']=='0'){
                        $message = '家庭地址经检测异常！';
                    }else{
                        $message = $homeaddress['data'];
                    }
                    $response = ['success'=>'OK','data'=>$homeaddress['data'],'message'=>$message,'address'=>$userData['liveaddress']];
                }else if(!empty($homeaddress['error'])){
                    $response = ['success'=>'ERROR','error'=>$homeaddress['error'],'message'=>$homeaddress['message'],'address'=>$userData['liveaddress']];
                }else{
                    $response = ['success'=>'ERROR','error'=>'10003','data'=>$homeaddress,'message'=>'数据调取失败！'];
                }
                break;
            case 'companyaddressverification':
                $companyaddress = $guard->companyAddressVerificationFilter(
                    $userData['companyaddress'],
                    $userData['tel']
                );
                if($companyaddress['success']===true){
                    if($companyaddress['data']=='1'){
                        $message = '工作地址经检测正确！';
                    }else if($companyaddress['data']=='2'){
                        $message = '无记录';
                    }else if($companyaddress['data']=='0'){
                        $message = '工作地址经检测异常！';
                    }else{
                        $message = $companyaddress['data'];
                    }
                    $response = ['success'=>'OK','data'=>$companyaddress['data'],'message'=>$message,'address'=>$userData['companyaddress']];
                }else if(!empty($companyaddress['error'])){
                    $response = ['success'=>'ERROR','error'=>$companyaddress['error'],'message'=>$companyaddress['message'],'address'=>$userData['companyaddress']];
                }else{
                    $response = ['success'=>'ERROR','error'=>'10004','data'=>$companyaddress,'message'=>'数据调取失败！'];
                }
                break;
            case 'phonelist':
                $fileName="UserContactJson/{$userData['tel']}.json";
                $result=ossGetObject($fileName);
                $returnData=[];
                if($result){
                    $data=json_decode($result);
                    $returnData=[];
                    foreach($data as $val){
                        $nameObj=$val->name;
                        $phoneObj=$val->phoneNumbers;
                        if($phoneObj  && $nameObj){
                            $name=($nameObj->familyName?$nameObj->familyName:'').($nameObj->givenName?$nameObj->givenName:'');
                            $phone_arr=[];
                            foreach($phoneObj as $val){
                                $phone_arr[]=$val->value;
                            }
                            $arr=[];
                            $arr["name"]=$name;
                            $arr["phone"]=$phone_arr;
                            $returnData[]=$arr;
                        }
                        
                    }
                }else{
                    $returnData = [];
                }
                $response = ['success'=>'OK','data'=>$returnData];
                break;
            case 'cheattcation':
                $fraudtion = $guard->fraudJudgment($userData['identify'],$userData['tel']);
                if($fraudtion['success'] == "1"){
                    if($fraudtion['result_desc']['AUTHENTICATION_MODEL']){
                        $response = ['success'=>'OK','message'=>$fraudtion['result_desc']['AUTHENTICATION_MODEL']];
                    }else{
                        $response = ['success'=>'ERROR','message'=>$fraudtion['result_desc']['INFOQUERY']['error_info']];
                    }
                }else{
                    $response = ['success'=>'ERROR','message'=>"获取失败"];
                }
            break;
            case "creditcation":
                $redittion = $guard->creditScore($userData['identify'],$userData['tel'],$userData['fullanme']);
                if($redittion['success'] =="1"){

                    $response = ['success'=>'OK','message'=>$redittion['result_desc']['CREDITSCORE']];
                }else{
                    $response = ['success'=>'ERROR','message'=>"数据调取失败!"];
                }
            break;
            default:
                $response = ['success'=>'ERROR','error'=>'10005','message'=>'数据调取失败！'];
                break;
        }

        $this->ajaxReturn($response);
    }

    /**
     * 百融风险罗盘数据查询
     */
    public function hundre()
    {
        $apiname = I("post.api_name");
        $userid = I("post.userid");
        $wayid  = I('post.wayid');
        $wayuser   = M('wayuser');
        $user_mdb  = M('user');
        $hundre = new HundredCredit;
        if($wayid){
            $userData  = $wayuser->where(array('id'=>$userid))->field('identify,name,banknum,tel')->find();
            $userData['fullanme'] = $userData['name'];
        }else{
            $userData  = $user_mdb->where(array('id'=>$userid))->field('identify,fullanme,liveaddress,companyaddress,tel,credittype,banknum')->find();
        }
        // $userData = array(
        //         'identify'=>'140502198811102244',
        //         'tel'=>'13986671110',
        //         'fullanme'=>'王亮',
        //         // 'fullanme'=>'王晓亮',
        //         'companyaddress'=>'北京市朝阳区建国路',
        //         'liveaddress'=>'重庆市大足区玉龙镇黄桷村村3组14号',
        //         'credittype'=>1,
        //         'banknum'=>'6222020506007000800',
        //     );
        // $userData = array(
        //         'identify'=>'500225199402064312',
        //         'tel'=>'17783641562',
        //         'fullanme'=>'左定强',
        //         // 'fullanme'=>'王晓亮',
        //         'companyaddress'=>'北京市朝阳区建国路',
        //         'liveaddress'=>'重庆市大足区玉龙镇黄桷村村3组14号',
        //         'credittype'=>1,
        //         'banknum'=>'6214830162447196',
        //     );
        switch ($apiname) {
            //特殊名单验证
            case 'specialList':
                $speciares = $hundre->specialListFilter($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$speciares['success']){
                    $response = ['success'=>'ERROR','error'=>$speciares['error'],'message'=>$speciares['message']];
                    break;
                }
                if(!isset($speciares['hit'])){
                    $response = ['success'=>'OK','message'=>'未命中任何风险'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$speciares['hit'],'message'=>'查询成功。'];
                break;

            //借贷意向验证
            case 'loanIntention':
                $loanIntentionres = $hundre->loanIntentionFilter($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$loanIntentionres['success']){
                    $response = ['success'=>'ERROR','error'=>$loanIntentionres['error'],'message'=>$loanIntentionres['message']];
                    break;
                }
                if(!isset($loanIntentionres['hit'])){
                    $response = ['success'=>'OK','message'=>'无信贷申请记录'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$loanIntentionres['hit'],'message'=>'查询成功。'];
                break;

            //实名信息验证
            case 'realNameInfo':
                $realNameInfores = $hundre->realNameInfoFilter($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$realNameInfores['success']){
                    $response = ['success'=>'ERROR','error'=>$realNameInfores['error'],'message'=>$realNameInfores['message']];
                    break;
                }
                if(!isset($realNameInfores['hit'])){
                    $response = ['success'=>'OK','message'=>'无信息记录。'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$realNameInfores['hit'],'message'=>'查询成功。'];
                break;

            //法院被执行人—个人版
            case 'courtExecution':
                $courtExecutionres = $hundre->courtExecutionFilter($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$courtExecutionres['success']){
                    $response = ['success'=>'ERROR','error'=>$courtExecutionres['error'],'message'=>$courtExecutionres['message']];
                    break;
                }
                if(!isset($courtExecutionres['hit'])){
                    $response = ['success'=>'OK','message'=>'无信息记录。'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$courtExecutionres['hit'],'message'=>'查询成功。'];
                break;

            //支付消费信息识别—月度版
            case 'payConsumption': 
                $payConsumptionres = $hundre->payConsumptionFilter($userData['identify'],$userData['tel'],$userData['fullanme'],$userData['banknum']);
                if(!$payConsumptionres['success']){
                    $response = ['success'=>'ERROR','error'=>$payConsumptionres['error'],'message'=>$payConsumptionres['message']];
                    break;
                }
                if(!isset($payConsumptionres['hit'])){
                    $response = ['success'=>'OK','message'=>'无信息记录。'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$payConsumptionres['hit'],'message'=>'查询成功。'];
                break;

            //自然人识别
            case 'badInfo':
                $badInfores = $hundre->badInfo($userData['identify'],$userData['tel'],$userData['fullanme']);
                
                if(!$badInfores['success']){
                    $response = ['success'=>'ERROR','error'=>$badInfores['error'],'message'=>$badInfores['message']];
                    break;
                }else if($hundre->errorNumber($badInfores['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$badInfores['data']['code'],'message'=>$hundre->errorNumber($badInfores['data']['code'])];
                    break;
                }else if(!isset($badInfores['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($badInfores['data']['flag']['flag_badinfo'] =='1'){
                    if($badInfores['data']['product']['wfxwCheckresult']=='1'){
                        $response = ['success'=>'OK','hit'=>$badInfores['data']['product']['item']['caseTime'].'年（单位）','message'=>'查询成功'];
                    }else{
                        $response = ['success'=>'OK','message'=>'暂无数据'];
                    }
                }else if($badInfores['data']['flag']['flag_badinfo']=='0'){
                    $response = ['success'=>'OK','message'=>'暂无数据'];
                }else if($badInfores['data']['flag']['flag_badinfo']=='99'){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'数据查询失败！请联系客服处理'];
                }
                break;
            //手机三要素简版—移动联通电信
            case 'phoneEssential':
                $phoneEssentialres = $hundre->phoneEssential($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$phoneEssentialres['success']){
                    $response = ['success'=>'ERROR','error'=>$phoneEssentialres['error'],'message'=>$phoneEssentialres['message']];
                    break;
                }else if($hundre->errorNumber($phoneEssentialres['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$phoneEssentialres['data']['code'],'message'=>$hundre->errorNumber($phoneEssentialres['data']['code'])];
                    break;
                }else if(!isset($phoneEssentialres['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($phoneEssentialres['data']['flag']['flag_telcheck']=='1'){
                    $response['success'] = "OK";
                    $operation = ['1'=>'电信','2'=>'联通','3'=>'移动','4'=>"其他"];
                    $result_d = ['0'=>'查无此号','1'=>'与身份证一致','2'=>'与身份证不一致'];
                    $response['operation'] = $operation[$phoneEssentialres['data']['product']['operation']];
                    if($phoneEssentialres['data']['product']['operation']!='4'){
                        $response['result'] = $result_d[$phoneEssentialres['data']['product']['result']];
                    }else{
                        $response['result'] = '未识别运营商';

                    }
                }else{
                    $response = ['success'=>'OK','message'=>'暂无数据'];
                }
                break;
            // 学历查询
            case 'educationInquiries':
                $educationInquiries = $hundre->educationInquiries($userData['identify'],$userData['fullanme'],$userData['tel']);

                if(!$educationInquiries['success']){
                    $response = ['success'=>'ERROR','error'=>$educationInquiries['error'],'message'=>$educationInquiries['message']];
                    break;
                }else if($hundre->errorNumber($educationInquiries['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$educationInquiries['data']['code'],'message'=>$hundre->errorNumber($educationInquiries['data']['code'])];
                    break;
                }else if(!isset($educationInquiries['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($educationInquiries['data']['flag']['flag_edulevel']=='1'){
                    $response['success'] = "OK";
                    $response['operation'] = $educationInquiries['data']['product']['data']['info'];
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //身份证二要素验证
            case 'identityVerific':
                $identityVerific = $hundre->identityVerific($userData['identify'],$userData['fullanme']);
                if(!$identityVerific['success']){
                    $response = ['success'=>'ERROR','error'=>$identityVerific['error'],'message'=>$identityVerific['message']];
                    break;
                }else if($hundre->errorNumber($identityVerific['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$identityVerific['data']['code'],'message'=>$hundre->errorNumber($identityVerific['data']['code'])];
                    break;
                }else if(!isset($identityVerific['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($identityVerific['data']['flag']['flag_idtwo_z']=='1'){
                    $response['success'] = "OK";
                    $response['message'] = $identityVerific['data']['product']['MESSAGE'];
                    
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //身份证二要素验证及照片查询
            case 'identityVerificAndFind':
                $identityVerificAndFind = $hundre->identityVerificAndFind($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$identityVerificAndFind['success']){
                    $response = ['success'=>'ERROR','error'=>$identityVerificAndFind['error'],'message'=>$identityVerificAndFind['message']];
                    break;
                }else if($hundre->errorNumber($identityVerificAndFind['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$identityVerificAndFind['data']['code'],'message'=>$hundre->errorNumber($identityVerificAndFind['data']['code'])];
                    break;
                }else if(!isset($identityVerificAndFind['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($identityVerificAndFind['data']['flag']['flag_idtwo_photo']=='1'){
                    $result_d = ['1'=>'身份一致','2'=>'身份证不一致','3'=>'无此记录','4'=>'身份证一致无照片'];
                    $response['success'] = "OK";
                    $response['message'] = $result_d[$identityVerificAndFind['data']['product']['result']];
                    
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //银行卡四要素验证
            case 'bankFourPro':
                $bankFourPro = $hundre->bankFourPro($userData['identify'],$userData['tel'],$userData['fullanme'],$userData['banknum']);
                
                if(!$bankFourPro['success']){
                    $response = ['success'=>'ERROR','error'=>$bankFourPro['error'],'message'=>$bankFourPro['message']];
                    break;
                }else if($hundre->errorNumber($bankFourPro['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$bankFourPro['data']['code'],'message'=>$hundre->errorNumber($bankFourPro['data']['code'])];
                    break;
                }else if(!isset($bankFourPro['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }

                if($bankFourPro['data']['flag']['flag_bankfour']=='1'){
                    $response['success'] = "OK";
                    $response['message'] = $bankFourPro['data']['product']['msg'];
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //手机在网时长—移动联通电信
            case 'telPeriod':
                $telPeriod = $hundre->telPeriod($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$telPeriod['success']){
                    $response = ['success'=>'ERROR','error'=>$telPeriod['error'],'message'=>$telPeriod['message']];
                    break;
                }else if($hundre->errorNumber($telPeriod['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$telPeriod['data']['code'],'message'=>$hundre->errorNumber($telPeriod['data']['code'])];
                    break;
                }else if(!isset($telPeriod['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($telPeriod['data']['flag']['flag_telperiod']=='1'){
                     $result_d = ['1'=>'电信','2'=>'联通','3'=>'移动','4'=>'其他运营商'];
                     $datavalue = ['0'=>'无结果','1'=>'0~6个月','2'=>'6~12个月','3'=>'12~24个月','4'=>"24个月以上"];
                     if($telPeriod['data']['product']['result'] == "1"){
                        $response['success'] = "OK";
                        $response['operation'] = $result_d[$telPeriod['data']['product']['operation']];
                        $response['datavalue'] = $datavalue[$telPeriod['data']['product']['data']['value']];
                     }else{
                        $response = ['success'=>'ERROR','message'=>'无结果'];
                     }
                    
                    
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //手机在网状态—移动联通电信
            case 'telStatus':
                $telStatus = $hundre->telStatus($userData['identify'],$userData['tel'],$userData['fullanme']);

                if(!$telStatus['success']){
                    $response = ['success'=>'ERROR','error'=>$telStatus['error'],'message'=>$telStatus['message']];
                    break;
                }else if($hundre->errorNumber($telStatus['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$telStatus['data']['code'],'message'=>$hundre->errorNumber($telStatus['data']['code'])];
                    break;
                }else if(!isset($telStatus['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($telStatus['data']['flag']['flag_telstatus']=='1'){
                     $result_d = ['1'=>'电信','2'=>'联通','3'=>'移动','4'=>'其他运营商'];
                     $datavalue = ['0'=>'无结果','1'=>'正常','2'=>'停机','3'=>'销号','4'=>"异常(包括销号,不在网)"];
                     if($telStatus['data']['product']['result'] == "1"){
                        $response['success'] = "OK";
                        $response['operation'] = $result_d[$telStatus['data']['product']['operation']];
                        $response['datavalue'] = $datavalue[$telStatus['data']['product']['data']['value']];
                     }else{
                        $response = ['success'=>'ERROR','message'=>'无结果'];
                     }
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //百融风险识别
            case 'scorelargecashv1':
                $scorelargecashv1 = $hundre->scorelargecashv1($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$scorelargecashv1['success']){
                    $response = ['success'=>'ERROR','error'=>$scorelargecashv1['error'],'message'=>$scorelargecashv1['message']];
                    break;
                }else if($hundre->errorNumber($scorelargecashv1['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$scorelargecashv1['data']['code'],'message'=>$hundre->errorNumber($scorelargecashv1['data']['code'])];
                    break;
                }else if(!isset($scorelargecashv1['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($scorelargecashv1['data']['flag_score']=='1'){
                     $response['message'] = $scorelargecashv1['data']['scorelargecashv1'];
                     $response['success'] = "OK";
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;

            default:
                $response = [];
                break;
        }
        
        $this->ajaxReturn($response);
    }

    /**
     * 
     */
    public function creditlistdetails(){
        $data = I("get.");
        $user = M('user');
        $res  = $user->where(array('id'=>$data['uid']))->field('identify,fullanme,liveaddress,companyaddress,tel,credittype')->find();
        if($res['credittype'] == 1){
            $params = [
                "id_number"                 => $res['identify'],
                "account_name"              => $res['fullanme'],
                "account_mobile"            => $res['tel'],
                "lend_family_address"       => $res['liveaddress'],
                "account_address_work"      => $res['companyaddress'],
            ];
            $creditModel=D('credit');
            $datares = $creditModel->getCredit($params);
            if($res['credittype'] != -1){
                    if($datares['credit']['code'] == 0){
                        $user->where(array('id'=>$data['uid']))->save(array('credittype'=>-1));
                        $datares['credittype'] = $res['credittype'];
                    }elseif($datares['credit']['code'] == 1){
                            $datares['credittype'] = $res['credittype'];
                            $user->where(array('id'=>$data['uid']))->save(array('credittype'=>1));
                            $datares['lend_family_address'] =$params['lend_family_address'];
                            $datares['account_address_work'] =$params['account_address_work'];
                            $str = $datares['credit']['data']['monbileOnline'];
                            $str=trim($str, "(");
                            $str=trim($str, "[");
                            $str=trim($str, "]");
                            $str=trim($str, ")");
                            $rest=explode(',', $str);
                            if($rest[1] == "+"){
                               $datares['tosay'] = "24个月以上"; 
                            }else{
                                $datares['tosay'] = "0~6个月";
                            }
                    }
            }else{
               $datares['credittype'] = $res['credittype'];
            }
        }else{
            $datares['credittype'] = $res['credittype'];
        }
        $this->assign('creditlist',$datares);
        $this->assign('recordcount',count($datares['credit']['data']['record']));
        $this->assign('dataid', $data['uid']);
        $this->display();
    }

    public function creditIndex(){
        $data = I("post.");
        $user = M('user');
        $res  = $user->where(array('id'=>$data['id']))->field('identify,fullanme,liveaddress,companyaddress,tel,credittype')->find();
        if($res){
            $params = [
                "id_number"                 => $res['identify'],
                "account_name"              => $res['fullanme'],
                "account_mobile"            => $res['tel'],
                "lend_family_address"       => $res['liveaddress'],
                "account_address_work"      => $res['companyaddress'],
            ];
            $creditModel=D('credit');
            $datares = $creditModel->getCredit($params);
            $res['credittype'] == -1;
            if($res['credittype'] != -1){
                    if($datares['credit']['code'] == 0){
                        $datares['credittype'] = "-1";
                        $user->where(array('id'=>$data['id']))->save(array('credittype'=>-1));
                        $datares['credittype'] = "-1";
                    }elseif($datares['credit']['code'] == 1){
                            $datares['credittype'] = $res['credittype'];
                            $user->where(array('id'=>$data['id']))->save(array('credittype'=>1));
                            $datares['lend_family_address'] =$params['lend_family_address'];
                            $datares['account_address_work'] =$params['account_address_work'];
                            $str = $datares['credit']['data']['monbileOnline'];
                            $str=trim($str, "(");
                            $str=trim($str, "[");
                            $str=trim($str, "]");
                            $str=trim($str, ")");
                            $rest=explode(',', $str);
                            if($rest[1] == "+"){
                               $datares['tosay'] = "24个月以上"; 
                            }else{
                                $datares['tosay'] = "0~6个月";
                            }
                    }
            }else{
               $datares['credittype'] = "-1";
            }
        }else{
             $datares['credittype'] = "-1";
        }
         
        $this->ajaxReturn($datares);
    }
    /**
     * 人员风险查询(模板加载)
     */
    public function peoplerisk(){
        $this->display();
    }
    public function reskcheck(){
        $userData = I('post.');
        $guard     = new Bodyguard;
        $hundre    = new HundredCredit;
        switch($userData['creditype']){
            /**
             * 同盾接口
             */
            case 'antifraud':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $antidata = $guard->antiFraudFilter(
                    $userData['fullanme'],
                    $userData['identify'],
                    $userData['tel']
                );
                if($antidata['success']===true){
                    $response = ['success'=>'OK','message'=>$antidata['message']];
                }else if($antidata['success']=='1'&&$antidata['data']){
                    $response = ['success'=>'OK','message'=>'身份信息监测到异常','data'=>$antidata['data']];
                }else if(!$antidata['success']){
                    $response = ['success'=>'ERROR','error'=>$antidata['error'],'message'=>$antidata['message']];
                }else{
                    $response = ['success'=>'ERROR','error'=>'10001','message'=>'数据调取异常！','data'=>$antidata];
                }
                break;
            case 'phonewhenlong':
                if(!$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $phonewhendata = $guard->phoneWhenlongFilter(
                    $userData['tel']
                );
                if($phonewhendata['success']===true){
                    $str = $phonewhendata['data'];
                    $str=trim($str, "(");
                    $str=trim($str, "[");
                    $str=trim($str, "]");
                    $str=trim($str, ")");
                    $rest=explode(',', $str);
                    if($rest[1] == "+"){
                       $datares_m = "24个月以上";
                    }else{
                       $datares_m = "0~6个月";
                    }
                    $response = [
                        'success'=>'OK',
                        'data'=>$datares_m.'/'.$phonewhendata['data'],
                        'message'=>'数据调取成功'
                    ];
                }else if(!empty($phonewhendata['error'])){
                    $response = ['success'=>'ERROR','error'=>$phonewhendata['erro'],'message'=>$phonewhendata['message']."\nERROR:".$phonewhendata['erro']];
                }else{
                    $response = ['success'=>'ERROR','error'=>'10002','data'=>$phonewhendata,'message'=>'数据调取异常！'];
                }
                break;
            case 'homeaddressverification':
                if(!$userData['tel'] || !$userData['liveaddress'] || !$userData['identify'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $homeaddress = $guard->homeAddressVerificationFilter(
                    $userData['liveaddress'],
                    $userData['tel']
                );
                if($homeaddress['success']===true){
                    if($homeaddress['data']=='1'){
                        $message = '家庭地址经检测正确！';
                    }else if($homeaddress['data']=='2'){
                        $message = '无记录';
                    }else if($homeaddress['data']=='0'){
                        $message = '家庭地址经检测异常！';
                    }else{
                        $message = $homeaddress['data'];
                    }
                    $response = ['success'=>'OK','data'=>$homeaddress['data'],'message'=>$message,'address'=>$userData['liveaddress']];
                }else if(!empty($homeaddress['error'])){
                    $response = ['success'=>'ERROR','error'=>$homeaddress['error'],'message'=>$homeaddress['message'],'address'=>$userData['liveaddress']];
                }else{
                    $response = ['success'=>'ERROR','error'=>'10003','data'=>$homeaddress,'message'=>'数据调取失败！'];
                }
                break;
            case 'companyaddressverification':
                if(!$userData['tel'] || !$userData['companyaddress'] || !$userData['identify'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $companyaddress = $guard->companyAddressVerificationFilter(
                    $userData['companyaddress'],
                    $userData['tel']
                );
                if($companyaddress['success']===true){
                    if($companyaddress['data']=='1'){
                        $message = '工作地址经检测正确！';
                    }else if($companyaddress['data']=='2'){
                        $message = '无记录';
                    }else if($companyaddress['data']=='0'){
                        $message = '工作地址经检测异常！';
                    }else{
                        $message = $companyaddress['data'];
                    }
                    $response = ['success'=>'OK','data'=>$companyaddress['data'],'message'=>$message,'address'=>$userData['companyaddress']];
                }else if(!empty($companyaddress['error'])){
                    $response = ['success'=>'ERROR','error'=>$companyaddress['error'],'message'=>$companyaddress['message'],'address'=>$userData['companyaddress']];
                }else{
                    $response = ['success'=>'ERROR','error'=>'10004','data'=>$companyaddress,'message'=>'数据调取失败！'];
                }
                break;
            case 'phonelist':
                $fileName="UserContactJson/{$userData['tel']}.json";
                $result=ossGetObject($fileName);
                $returnData=[];
                if($result){
                    $data=json_decode($result);
                    $returnData=[];
                    foreach($data as $val){
                        $nameObj=$val->name;
                        $phoneObj=$val->phoneNumbers;
                        if($phoneObj  && $nameObj){
                            $name=($nameObj->familyName?$nameObj->familyName:'').($nameObj->givenName?$nameObj->givenName:'');
                            $phone_arr=[];
                            foreach($phoneObj as $val){
                                $phone_arr[]=$val->value;
                            }
                            $arr=[];
                            $arr["name"]=$name;
                            $arr["phone"]=$phone_arr;
                            $returnData[]=$arr;
                        }
                        
                    }
                }else{
                    $returnData = [];
                }
                $response = ['success'=>'OK','data'=>$returnData];
                break;
            case 'cheattcation':
                if(!$userData['identify'] || !$userData['tel']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $fraudtion = $guard->fraudJudgment($userData['identify'],$userData['tel']);

                if($fraudtion['success'] == "1"){

                    if($fraudtion['result_desc']['AUTHENTICATION_MODEL']){
                        $response = ['success'=>'OK','message'=>$fraudtion['result_desc']['AUTHENTICATION_MODEL']];
                    }else{
                        $response = ['success'=>'ERROR','message'=>$fraudtion['result_desc']['INFOQUERY']['error_info']];
                    }
                }else{
                    $response = ['success'=>'ERROR','message'=>"获取失败"];
                }
                break;
            case "creditcation":
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $redittion = $guard->creditScore($userData['identify'],$userData['tel'],$userData['fullanme']);
                if($redittion['success'] =="1"){

                    $response = ['success'=>'OK','message'=>$redittion['result_desc']['CREDITSCORE']];
                }else{
                    $response = ['success'=>'ERROR','message'=>"数据调取失败!"];
                }
                break;
            /**
             * 百融风险接口
             */
            //特殊名单验证
            case 'specialList':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $speciares = $hundre->specialListFilter($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$speciares['success']){
                    $response = ['success'=>'ERROR','error'=>$speciares['error'],'message'=>$speciares['message']];
                    break;
                }
                if(!isset($speciares['hit'])){
                    $response = ['success'=>'OK','message'=>'未命中任何风险'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$speciares['hit'],'message'=>'查询成功。'];
                break;

            //借贷意向验证
            case 'loanIntention':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $loanIntentionres = $hundre->loanIntentionFilter($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$loanIntentionres['success']){
                    $response = ['success'=>'ERROR','error'=>$loanIntentionres['error'],'message'=>$loanIntentionres['message']];
                    break;
                }
                if(!isset($loanIntentionres['hit'])){
                    $response = ['success'=>'OK','message'=>'无信贷申请记录'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$loanIntentionres['hit'],'message'=>'查询成功。'];
                break;

            //实名信息验证
            case 'realNameInfo':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $realNameInfores = $hundre->realNameInfoFilter($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$realNameInfores['success']){
                    $response = ['success'=>'ERROR','error'=>$realNameInfores['error'],'message'=>$realNameInfores['message']];
                    break;
                }
                if(!isset($realNameInfores['hit'])){
                    $response = ['success'=>'OK','message'=>'无信息记录。'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$realNameInfores['hit'],'message'=>'查询成功。'];
                break;

            //法院被执行人—个人版
            case 'courtExecution':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $courtExecutionres = $hundre->courtExecutionFilter($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$courtExecutionres['success']){
                    $response = ['success'=>'ERROR','error'=>$courtExecutionres['error'],'message'=>$courtExecutionres['message']];
                    break;
                }
                if(!isset($courtExecutionres['hit'])){
                    $response = ['success'=>'OK','message'=>'无信息记录。'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$courtExecutionres['hit'],'message'=>'查询成功。'];
                break;

            //支付消费信息识别—月度版
            case 'payConsumption':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $payConsumptionres = $hundre->payConsumptionFilter($userData['identify'],$userData['tel'],$userData['fullanme'],$userData['banknum']);
                if(!$payConsumptionres['success']){
                    $response = ['success'=>'ERROR','error'=>$payConsumptionres['error'],'message'=>$payConsumptionres['message']];
                    break;
                }
                if(!isset($payConsumptionres['hit'])){
                    $response = ['success'=>'OK','message'=>'无信息记录。'];
                    break;
                }
                $response = ['success'=>'OK','hit'=>$payConsumptionres['hit'],'message'=>'查询成功。'];
                break;

            //自然人识别
            case 'badInfo':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $badInfores = $hundre->badInfo($userData['identify'],$userData['tel'],$userData['fullanme']);
                
                if(!$badInfores['success']){
                    $response = ['success'=>'ERROR','error'=>$badInfores['error'],'message'=>$badInfores['message']];
                    break;
                }else if($hundre->errorNumber($badInfores['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$badInfores['data']['code'],'message'=>$hundre->errorNumber($badInfores['data']['code'])];
                    break;
                }else if(!isset($badInfores['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($badInfores['data']['flag']['flag_badinfo'] =='1'){
                    if($badInfores['data']['product']['wfxwCheckresult']=='1'){
                        $response = ['success'=>'OK','hit'=>$badInfores['data']['product']['item']['caseTime'].'年（单位）','message'=>'查询成功'];
                    }else{
                        $response = ['success'=>'OK','message'=>'暂无数据'];
                    }
                }else if($badInfores['data']['flag']['flag_badinfo']=='0'){
                    $response = ['success'=>'OK','message'=>'暂无数据'];
                }else if($badInfores['data']['flag']['flag_badinfo']=='99'){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'数据查询失败！请联系客服处理'];
                }
                break;
            //手机三要素简版—移动联通电信
            case 'phoneEssential':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $phoneEssentialres = $hundre->phoneEssential($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$phoneEssentialres['success']){
                    $response = ['success'=>'ERROR','error'=>$phoneEssentialres['error'],'message'=>$phoneEssentialres['message']];
                    break;
                }else if($hundre->errorNumber($phoneEssentialres['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$phoneEssentialres['data']['code'],'message'=>$hundre->errorNumber($phoneEssentialres['data']['code'])];
                    break;
                }else if(!isset($phoneEssentialres['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($phoneEssentialres['data']['flag']['flag_telcheck']=='1'){
                    $response['success'] = "OK";
                    $operation = ['1'=>'电信','2'=>'联通','3'=>'移动','4'=>"其他"];
                    $result_d = ['0'=>'查无此号','1'=>'与身份证一致','2'=>'与身份证不一致'];
                    $response['operation'] = $operation[$phoneEssentialres['data']['product']['operation']];
                    if($phoneEssentialres['data']['product']['operation']!='4'){
                        $response['result'] = $result_d[$phoneEssentialres['data']['product']['result']];
                    }else{
                        $response['result'] = '未识别运营商';

                    }
                }else{
                    $response = ['success'=>'OK','message'=>'暂无数据'];
                }
                break;
            // 学历查询
            case 'educationInquiries':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $educationInquiries = $hundre->educationInquiries($userData['identify'],$userData['fullanme'],$userData['tel']);

                if(!$educationInquiries['success']){
                    $response = ['success'=>'ERROR','error'=>$educationInquiries['error'],'message'=>$educationInquiries['message']];
                    break;
                }else if($hundre->errorNumber($educationInquiries['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$educationInquiries['data']['code'],'message'=>$hundre->errorNumber($educationInquiries['data']['code'])];
                    break;
                }else if(!isset($educationInquiries['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($educationInquiries['data']['flag']['flag_edulevel']=='1'){
                    $response['success'] = "OK";
                    $response['operation'] = $educationInquiries['data']['product']['data']['info'];
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //身份证二要素验证
            case 'identityVerific':
                if(!$userData['identify'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $identityVerific = $hundre->identityVerific($userData['identify'],$userData['fullanme']);
                if(!$identityVerific['success']){
                    $response = ['success'=>'ERROR','error'=>$identityVerific['error'],'message'=>$identityVerific['message']];
                    break;
                }else if($hundre->errorNumber($identityVerific['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$identityVerific['data']['code'],'message'=>$hundre->errorNumber($identityVerific['data']['code'])];
                    break;
                }else if(!isset($identityVerific['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($identityVerific['data']['flag']['flag_idtwo_z']=='1'){
                    $response['success'] = "OK";
                    $response['message'] = $identityVerific['data']['product']['MESSAGE'];
                    
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //身份证二要素验证及照片查询
            case 'identityVerificAndFind':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $identityVerificAndFind = $hundre->identityVerificAndFind($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$identityVerificAndFind['success']){
                    $response = ['success'=>'ERROR','error'=>$identityVerificAndFind['error'],'message'=>$identityVerificAndFind['message']];
                    break;
                }else if($hundre->errorNumber($identityVerificAndFind['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$identityVerificAndFind['data']['code'],'message'=>$hundre->errorNumber($identityVerificAndFind['data']['code'])];
                    break;
                }else if(!isset($identityVerificAndFind['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($identityVerificAndFind['data']['flag']['flag_idtwo_photo']=='1'){
                    $result_d = ['1'=>'身份一致','2'=>'身份证不一致','3'=>'无此记录','4'=>'身份证一致无照片'];
                    $response['success'] = "OK";
                    $response['message'] = $result_d[$identityVerificAndFind['data']['product']['result']];
                    
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //银行卡四要素验证
            case 'bankFourPro':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme'] || !$userData['banknum']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $bankFourPro = $hundre->bankFourPro($userData['identify'],$userData['tel'],$userData['fullanme'],$userData['banknum']);
                
                if(!$bankFourPro['success']){
                    $response = ['success'=>'ERROR','error'=>$bankFourPro['error'],'message'=>$bankFourPro['message']];
                    break;
                }else if($hundre->errorNumber($bankFourPro['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$bankFourPro['data']['code'],'message'=>$hundre->errorNumber($bankFourPro['data']['code'])];
                    break;
                }else if(!isset($bankFourPro['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }

                if($bankFourPro['data']['flag']['flag_bankfour']=='1'){
                    $response['success'] = "OK";
                    $response['message'] = $bankFourPro['data']['product']['msg'];
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //手机在网时长—移动联通电信
            case 'telPeriod':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $telPeriod = $hundre->telPeriod($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$telPeriod['success']){
                    $response = ['success'=>'ERROR','error'=>$telPeriod['error'],'message'=>$telPeriod['message']];
                    break;
                }else if($hundre->errorNumber($telPeriod['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$telPeriod['data']['code'],'message'=>$hundre->errorNumber($telPeriod['data']['code'])];
                    break;
                }else if(!isset($telPeriod['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($telPeriod['data']['flag']['flag_telperiod']=='1'){
                     $result_d = ['1'=>'电信','2'=>'联通','3'=>'移动','4'=>'其他运营商'];
                     $datavalue = ['0'=>'无结果','1'=>'0~6个月','2'=>'6~12个月','3'=>'12~24个月','4'=>"24个月以上"];
                     if($telPeriod['data']['product']['result'] == "1"){
                        $response['success'] = "OK";
                        $response['operation'] = $result_d[$telPeriod['data']['product']['operation']];
                        $response['datavalue'] = $datavalue[$telPeriod['data']['product']['data']['value']];
                     }else{
                        $response = ['success'=>'ERROR','message'=>'无结果'];
                     }
                    
                    
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //手机在网状态—移动联通电信
            case 'telStatus':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $telStatus = $hundre->telStatus($userData['identify'],$userData['tel'],$userData['fullanme']);

                if(!$telStatus['success']){
                    $response = ['success'=>'ERROR','error'=>$telStatus['error'],'message'=>$telStatus['message']];
                    break;
                }else if($hundre->errorNumber($telStatus['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$telStatus['data']['code'],'message'=>$hundre->errorNumber($telStatus['data']['code'])];
                    break;
                }else if(!isset($telStatus['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($telStatus['data']['flag']['flag_telstatus']=='1'){
                     $result_d = ['1'=>'电信','2'=>'联通','3'=>'移动','4'=>'其他运营商'];
                     $datavalue = ['0'=>'无结果','1'=>'正常','2'=>'停机','3'=>'销号','4'=>"异常(包括销号,不在网)"];
                     if($telStatus['data']['product']['result'] == "1"){
                        $response['success'] = "OK";
                        $response['operation'] = $result_d[$telStatus['data']['product']['operation']];
                        $response['datavalue'] = $datavalue[$telStatus['data']['product']['data']['value']];
                     }else{
                        $response = ['success'=>'ERROR','message'=>'无结果'];
                     }
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            //百融风险识别
            case 'scorelargecashv1':
                if(!$userData['identify'] || !$userData['tel'] || !$userData['fullanme']){
                    $this->ajaxReturn(['success'=>'ERROR','message'=>"请全部输入正确"]);
                }
                $scorelargecashv1 = $hundre->scorelargecashv1($userData['identify'],$userData['tel'],$userData['fullanme']);
                if(!$scorelargecashv1['success']){
                    $response = ['success'=>'ERROR','error'=>$scorelargecashv1['error'],'message'=>$scorelargecashv1['message']];
                    break;
                }else if($hundre->errorNumber($scorelargecashv1['data']['code'])!==true){
                    $response = ['success'=>'ERROR','error'=>$scorelargecashv1['data']['code'],'message'=>$hundre->errorNumber($scorelargecashv1['data']['code'])];
                    break;
                }else if(!isset($scorelargecashv1['success'])){
                    $response = ['success'=>'ERROR','error'=>'L1002','message'=>'接口查询失败，请联系客服处理'];
                    break;
                }
                if($scorelargecashv1['data']['flag_score']=='1'){
                     $response['message'] = $scorelargecashv1['data']['scorelargecashv1'];
                     $response['success'] = "OK";
                }else{
                    $response = ['success'=>'ERROR','message'=>'暂无数据'];
                }
                break;
            
            default:
                $response = ['success'=>'ERROR','error'=>'10005','message'=>'数据调取失败！'];
                break;
        }
        $this->ajaxReturn($response);
    }
}
